From eb377664b907ce8b998ad7fa4e583906ee4ce102 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 15 Apr 2009 04:43:06 +0000 Subject: [PATCH] initPage() is far too late to be setting a title, so we'll do it right after newFromKey() is called. Allow getSkin() to be passed a title for context, else fall back to OutputPage's title. --- includes/Skin.php | 15 ++++++++++++--- includes/User.php | 12 +++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/includes/Skin.php b/includes/Skin.php index f2305a5e28..cbab61c29b 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -176,8 +176,6 @@ class Skin extends Linker { wfProfileIn( __METHOD__ ); - $this->mTitle = $out->getTitle(); - # Generally the order of the favicon and apple-touch-icon links # should not matter, but Konqueror (3.5.9 at least) incorrectly # uses whichever one appears later in the HTML source. Make sure @@ -268,12 +266,23 @@ class Skin extends Linker { } } - function setMembers(){ + /** + * Set some local globals + */ + protected function setMembers(){ global $wgUser; $this->mUser = $wgUser; $this->userpage = $wgUser->getUserPage()->getPrefixedText(); $this->usercss = false; } + + /** + * Set the title + * @param Title $t The title to use + */ + public function setTitle( $t ) { + $this->mTitle = $t; + } function outputPage( OutputPage $out ) { global $wgDebugComments; diff --git a/includes/User.php b/includes/User.php index 4798294079..8ab9b40ea8 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2144,11 +2144,12 @@ class User { } /** - * Get the current skin, loading it if required - * @return \type{Skin} Current skin + * Get the current skin, loading it if required, and setting a title + * @param Title $t The title to use in the skin + * @return Skin The current skin * @todo FIXME : need to check the old failback system [AV] */ - function &getSkin() { + function &getSkin( $t = null ) { global $wgRequest, $wgAllowUserSkin, $wgDefaultSkin; if ( ! isset( $this->mSkin ) ) { wfProfileIn( __METHOD__ ); @@ -2165,6 +2166,11 @@ class User { $this->mSkin =& Skin::newFromKey( $userSkin ); wfProfileOut( __METHOD__ ); } + if ( !$t ) { + global $wgOut; + $t = $wgOut->getTitle(); + } + $this->mSkin->setTitle( $t ); return $this->mSkin; } -- 2.20.1